class ReleasesController < ApplicationController
  filter_access_to :all
  layout Proc.new { |controller| controller.request.xhr? ? 'slim' : 'main' }

  def show
    @release = Release.find(params[:id])

    redirect_to release_edition_path(@release, @release.editions.first)
  end

  # GET /releases/new
  # GET /releases/new.xml
  def new
    @release = Release.new

    if params[:title]
      @release.title = params[:title]
    end

    respond_to do |format|
      format.html
      format.xml { render :xml => @release }
    end
  end

  # 
  #
  def create
    #Create a new entry with the provided parameters
    @release = Release.new(params[:release])
 
    if @release.save!
      redirect_to release_edition_path(@release, @release.editions.first)
    else
      render :action => :new
    end
  end

end
